<template>
  <view class="resourceDetail-container">
    <u-navbar
      title="文章详情"
      :fixed="false"
      :autoBack="true"
      bgColor="#f4f8fb"
    >
    </u-navbar>
    <view class="title">
      <view class="text">{{ title }}</view>
      <view class="day">发布时间: {{ day }}</view>
    </view>
    <view class="content">
      <u-parse :content="content"></u-parse>
    </view>
  </view>
</template>

<script>
import { request } from "@/utils/http.js";
export default {
  data() {
    return {
      content: "",
      title: "",
      day: "",
    };
  },
  onLoad(options) {
    this.getDetail(options.id);
  },

  methods: {
    getDetail(id) {
      request
        .post("/yishouzixun/getXiangqing", {
          id,
        })
        .then((res) => {
          console.log(res);
          this.content = res.data.content;
          this.title = res.data.title;
          this.day = res.data.created_at;
        });
    },
  },
};
</script>

<style lang="scss" scoped>
page {
  background-color: #fff;
}
.title {
  font-size: 32rpx;
  background: #f4f8fb;
  padding: 40rpx 20rpx;
  box-sizing: border-box;
  .text {
    letter-spacing: 4rpx;
    margin-left: 20rpx;
  }
  .day {
    font-size: 24rpx;
    color: #919599;
    margin-left: 20rpx;
    margin-top: 20rpx;
  }
}
.content {
  padding: 20rpx;
  box-sizing: border-box;
  font-size: 28rpx;
}
</style>
